<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="https://cdn.staticfile.org/vue/2.4.2/vue.min.js"></script>
</head>
<body>
<div id="app5">
    年齡：<input type="number" v-model="info5.age5"><br>
    提示信息：<span>{{infoMsg5}}</span>
</div>
<script type="text/javascript">
    var vm = new Vue({
        el: '#app5',
        data: {
            info5: {
                age5: "",
                name5: "",
                hobit5: ""
            },
            infoMsg5: ""
        },
        computed: {
            ageval: function () {
                return this.info5.age5;
            }
        },
        watch: {
            ageval: {
                handler: function (val, oldval) {
                    var that = this;
                    if (val > 0 && val < 15) {
                        that.infoMsg5 = "你还是个小孩";
                    } else if (val > 15 && val < 25) {
                        that.infoMsg5 = "你已经是个少年";
                    } else {
                        that.infoMsg5 = "你已经长大了";
                    }
                },
                deep: true
            }
        }
    })
</script>
</body>
</html>